home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot / sun4.md / RCS / idprom.c,v < prev    next >
Encoding:
Text File  |  1989-06-20  |  1.2 KB  |  67 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    mendel:1.1; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     89.06.20.10.51.28;  author mendel;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @
  26. /*
  27.  * @@(#)idprom.c 1.4 88/02/08
  28.  * Copyright (c) 1986 by Sun Microsystems, Inc.
  29.  */
  30.  
  31. #include "../h/idprom.h"
  32.  
  33. /*
  34.  * Read the ID prom and check it.
  35.  * Arguments are a format number and an address to store prom contents at.
  36.  *
  37.  * Result is format number if prom has the right format and good checksum.
  38.  * Result is -1           if prom has the right format and bad checksum.
  39.  * Result is prom's format if prom has the wrong format.
  40.  *
  41.  * If the PROM is in the wrong format, the addressed area is not changed.
  42.  *
  43.  * This routine must know the size, and checksum algorithm, of each format.
  44.  * (Currently there's only one.)
  45.  */
  46.  
  47. int
  48. idprom(format, idp)
  49.     unsigned char format;
  50.     register struct idprom *idp;
  51. {
  52.     unsigned char *cp, sum=0, promform;
  53.     short i;
  54.  
  55.     getidprom(&promform, 1);        /* Get format byte */
  56.     if (format != promform)
  57.         return promform;
  58.     getidprom((unsigned char *)idp, sizeof(*idp));    /* The whole thing */
  59.     cp = (unsigned char *)idp;
  60.     for (i=0; i<16; i++)
  61.         sum ^= *cp++;
  62.     if (sum != 0)
  63.         return -1;
  64.     return promform;
  65. }
  66. @
  67.